// Main.cs
// 
// Currently this holds some basic tests for the algorithm class, these will
// eventually be replaced by a test suite

using System;
using System.Collections.Generic;
using Mono.Algorithm;

namespace monoalgorithm
{
	class TestClass
	{
		private static void PrintSequence<T>(List<T> sequence)
		{
			for (int i = 0; i < sequence.Count; i++)
			{
				Console.Write("{0} ", sequence[i]);
			}
			
			Console.WriteLine();
		}
		
		private static void CreatePermutations()
		{
			List<char> sequence = new List<char>(new char[] { 'a', 'b', 'c', 'd' });
			
			try
			{
				do
				{
					PrintSequence<char>(sequence);
				}
				while (Algorithm.NextPermutation<char>(ref sequence, 0, sequence.Count - 1));
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.Message);
			}
		}
		
		private static void GreedyCoinCollector()
		{
			// Create list of candidates representing UK coinage in pence
			List<int> candidates = new List<int>() { 1, 2, 5, 10, 20, 50, 100, 200 };
			
			// Get a list of coins which make up £7.33
			Dictionary<int, int> coins = Algorithm.Greedy(candidates, 733);
			
			// Output the results
			foreach (int coin in coins.Keys)
			{
				// Output as "coin : number of times used"
				Console.WriteLine("{0} : {1}", coin, coins[coin]);
			}
		}
		
		public static void Main(string[] args)
		{
			//CreatePermutations();
			GreedyCoinCollector();
			
			Console.WriteLine("Press enter to continue ...");
			Console.ReadLine();
		}
	}
}